//
//  WmcBrandLibraryCell.swift
//  YPWatermarkCamera
//
//  Created by 赵新 on 2022/6/9.
//

import UIKit
import YPBedrock
import Kingfisher

class WmcBrandLibraryCell: WmcBaseCollectionCell {
    
    lazy var imageBackgroudView: UIView = {
        let view = UIView()
        view.backgroundColor = .wmc_grayH19_F5F5F5
        view.layer.cornerRadius = 8
        view.layer.masksToBounds = true
        return view
    }()
    
    
    override func makeUI() {
        imageBackgroudView.layer.cornerRadius = 12
        imageBackgroudView.layer.masksToBounds = true
        imageBackgroudView.backgroundColor = .wmc_mainTheme.yp.alpha(0.15)
        addSubview(imageBackgroudView)
        imageBackgroudView.snp.makeConstraints { make in
            make.top.left.right.equalToSuperview()
            make.bottom.equalTo(-40)
        }
        
        imageView.layer.cornerRadius = 4
        imageView.layer.masksToBounds = true
        imageView.contentMode = .scaleAspectFit
        imageBackgroudView.addSubview(imageView)
        imageView.snp.makeConstraints { make in
            make.top.left.equalTo(8)
            make.right.bottom.equalTo(-8)
        }
        
        titleLabel.font = 16.wmc_font
        titleLabel.textColor = .wmc_grayH2_323233
        titleLabel.textAlignment = .center
        addSubview(titleLabel)
        titleLabel.snp.makeConstraints { make in
            make.top.equalTo(imageBackgroudView.snp.bottom)
            make.left.right.bottom.equalToSuperview()
        }
    }
    
    func configModel(_ model: WmcMediaEnterpriseLogoModel.LogoData) {
        imageView.kf.setImage(with: model.imgUrl.yp.url)
        titleLabel.text = model.brandName
    }
}
